package controllers

import (
	"github.com/gin-gonic/gin"
	"my-gin-tiktok/app/services"
	"my-gin-tiktok/common/response"
	"strconv"
)

// Info 获取用户信息
func Info(ctx *gin.Context) {
	userID, _ := strconv.ParseInt(ctx.Keys["id"].(string), 10, 64)
	user, err := services.UserService.GetUserByID(ctx, userID)
	if err != nil {
		response.BusinessFail(ctx, err.Error())
		return
	}
	response.Success(ctx, user)
}
